<div class="breadcrumbwidget">
	<ul class="skins">
        <li><a href="default" class="skin-color default"></a></li>
        <li><a href="orange" class="skin-color orange"></a></li>
        <li>&nbsp;</li>
        <li class="fixed"><a href="" class="skin-layout fixed"></a></li>
        <li class="wide"><a href="" class="skin-layout wide"></a></li>
    </ul><!--skins-->
	<ul class="breadcrumb">
        <li><a href="<?php echo $baseurl?>">Trang chủ</a> <span class="divider">/</span></li>
        <li class="active">Sửa quản trị</li>
    </ul>
</div><!--breadcrumbwidget-->
<div class="pagetitle">
	<h1>Sửa quản trị</h1> <span></span>
</div>
<div class="maincontent">
    <?php if(validation_errors()):?>
        <div class="alert alert-error" style="margin: 10px 10px 10px 40px;">
          <button data-dismiss="alert" class="close" type="button">×</button>
          <?php echo validation_errors(); ?>
        </div>
    <?php endif;?>
    <div class="contentinner content-dashboard">    
    
    <?php $attr = array('class' => 'stdform'); echo form_open('', $attr)?>
    <input type="hidden" name="id" value="<?php echo $id;?>" />
    <p>
    	<label>Tên tài khoản ( * )</label>
        <span class="field"><input type="text" value="<?php echo $data->username?>" name="username" class="input-xlarge" placeholder="Nhập tên tài khoản" /></span>
    </p>
    <p>
    	<label>Mật khẩu ( * )</label>
        <span class="field"><input type="password" value="<?php echo $this->input->post('pword');?>" name="pword" class="input-xlarge" placeholder="Nhập mật khẩu" /></span>
    </p>
    <p>
    	<label>Nhập lại mật khẩu ( * )</label>
        <span class="field"><input type="password" value="<?php echo $this->input->post('pword2');?>" name="pword2" class="input-xlarge" placeholder="Nhập lại mật khẩu" /></span>
    </p>
    <p>
    	<label>Họ tên ( * )</label>
        <span class="field"><input type="text" value="<?php echo $data->fullname?>" name="fullname" class="input-xlarge" placeholder="Nhập họ tên" /></span>
    </p>
    
    <p>
    	<label>Email ( * )</label>
        <span class="field"><input type="text" value="<?php echo $data->email?>" name="email" class="input-xlarge" placeholder="Nhập email" /></span>
    </p>
    
    <p>
    	<label>Mobile ( * )</label>
        <span class="field"><input type="text" value="<?php echo $data->mobile?>" name="mobile" class="input-xlarge" placeholder="Nhập số điện thoại" /></span>
    </p>
    
    <p>
    	<label>Loại tài khoản</label>
        <span class="field">
            <select name="typeAccount" class="uniformselect">
                <?php echo $typeAccount;?>
            </select>
        </span>
    </p>
   
    <p>
    	<label>Trạng thái ( * )</label>
        <span class="field">
            <input type="checkbox" name="active" id="active" <?php echo $data->active == 1 ? 'checked="checked"' : '';?> class="input-small" placeholder="Trạng thái" value="1"/>
            Kích hoạt
        </span>
    </p>
     <p>
    	<label>Danh sách nhóm quyền: </label>
        <span class="field">
        <ul style="float: left;width: 75%;margin: 5px 0px 20px 10px; list-style: none">
        <?php if(!in_array($permission_list, array(null, '', '0'))):?>
           <?php foreach($permission_list AS $el=>$le):?>
           <li id="id_<?php echo $le->id?>"><?php echo $le->name_pm?> &nbsp; &nbsp; &nbsp;<a href="javascript: void(delete_permission(<?php echo $le->id?>))" class="delete_permission">[ Xóa ]</a></li>
           <?php endforeach;?>
        <?php else: ?>
           <li>Chưa có quyền gì</li>     
        <?php endif;?>
        </ul>
        </span>
    </p>
    <p>
        <label></label>
        <button class="btn btn-rounded" type="submit"> <i class="iconfa-ok"></i> &nbsp; Lưu lại</button>
        <button class="btn btn-rounded" type="button" onclick="window.location='<?php echo $baseurl.'manage/system/list-admin'?>'"> <i class="icon-arrow-right"></i> &nbsp; Hủy bỏ</button>
    </p>
    
    </form>
    </div>
</div>

<script>

  function delete_permission(_id)
  {
        var _id = _id;
        
        $.ajax({
            type: 'get',
            url: '<?php echo $baseurl?>manage/system/delete-permission-user',
            data: ({id: _id}),
            success: function(data)
            {
                $("#id_"+_id).remove();
            }
        });
  }

</script>